package com.example.abstractfactory;

import com.example.abstractfactory.factory.AbstractFactory;
import com.example.abstractfactory.factory.ColorFactory;
import com.example.abstractfactory.factory.ShapeFactory;
import org.springframework.util.StringUtils;

/**
 * @Description TODO
 * @Date 2021/10/21 11:05
 * @Author ZhangJi
 * @Version 1.0
 */
public class FactoryProducer {

  public static AbstractFactory getFactory(String factoryType){

    if (!StringUtils.hasLength(factoryType)) {
      return null;
    }
    if ("shape".equalsIgnoreCase(factoryType)){
      return new ShapeFactory();
    }else if ("color".equalsIgnoreCase(factoryType)){
      return new ColorFactory();
    }
    return null;

  }

}
